package com.amumu.controller.api;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.amumu.dto.TopDataDto;
import com.amumu.enums.ContentInfoEnum;
import com.amumu.po.ContentInfo;
import com.amumu.po.Slider;
import com.amumu.service.ContentInfoDataService;
import com.amumu.service.SliderDataService;
import com.amumu.service.TopDataService;
import com.amumu.utils.ResultVOUtil;
import com.amumu.vo.ResultVO;

@RestController
@CrossOrigin(origins = "*", maxAge = 3600)
@RequestMapping("/api")
public class ApiController {
	
	 @Autowired
	 TopDataService topDataService;
	 
	 @Autowired
	 SliderDataService sliderDataService;
	 
	 @Autowired
	 ContentInfoDataService contentInfoDataService;
	 
	 @GetMapping("/initTopData")
	 public ResultVO initWishData() {
		TopDataDto topDataDto = topDataService.topDataOne();
		return ResultVOUtil.success(topDataDto);
	 }
	 
	 
	 @GetMapping("/initSliderData")
	 public ResultVO initSliderData() {
		List<Slider> sliderDatas = sliderDataService.findAll();
		return ResultVOUtil.success(sliderDatas);
	 }
	 
	 
	 @GetMapping("/initExperienceData")
	 public ResultVO initExperienceData() {
		List<ContentInfo> sliderDatas = contentInfoDataService.findAll(ContentInfoEnum.Experience.getType());
		return ResultVOUtil.success(sliderDatas);
	 }
	 
	 
}
